package com.lx.chong.common;

import com.lx.chong.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author: chong
 * @date: 2018/1/16
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> implements Serializable {

    private static final long serialVersionUID = 7941574207497841441L;
    /** 错误码. */
    private Integer code = 0;

    /** 提示信息. */
    private String msg;

    /** 具体内容. */
    private T data;

    public Result(ResultEnum resultEnum, T data) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMessage();
        this.data = data;
    }
}
